package com.example.smartcity_40.home

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.text.Html
import android.util.Log
import com.bumptech.glide.Glide
import com.example.smartcity_40.R
import com.example.smartcity_40.databinding.ActivityHomeNewsInfoBinding
import com.example.smartcity_40.tool.Tool
import com.example.smartcity_40.tool.tool
import com.example.smartcity_40.tool.viewBinding

class HomeNewsInfoActivity : AppCompatActivity() {
    private val vb by viewBinding(ActivityHomeNewsInfoBinding::inflate)
    val TAG = "HomeNewsInfoActivity"
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(vb.root)
        vb.homeNewsInfoBack.setOnClickListener {
            finish()
        }
        val id = intent.getIntExtra("id",0)
        tool.apply {
            send("/prod-api/press/press/$id",Tool.GET,null,false,HomeNewsBean::class.java) {
                vb.homeNewsInfoTitle.text = it.data.title
                vb.homeNewsInfoText.text = Html.fromHtml(it.data.content)
                Glide.with(context).load(getUrl(it.data.cover)).into(vb.homeNewsInfoImg)
            }
        }
    }
}